package com.ewing.busi.web.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.ewing.busi.web.dao.WebBlockVarDao;
import com.ewing.busi.web.model.WebBlockVar;
import com.ewing.common.exception.WebBlockException;

/**
 * 网站块关联参数
 * 
 * @author tansonlam
 * @createDate 2016年6月2日
 * 
 */
@Repository("webBlockVarService")
public class WebBlockVarService {
	@Resource
	private WebBlockVarDao webBlockVarDao;

	/**
	 * 查询
	 * 
	 * @param shopId
	 * @param blockVarId
	 * @return
	 */
	public WebBlockVar findBlockVar(Integer shopId, Integer blockVarId) {
		return webBlockVarDao.findBlockVar(shopId, blockVarId);
	}

	/**
	 * 检查是否有块元素操作权限
	 * 
	 * @param shopId
	 * @param blockVarId
	 * @throws WebBlockException
	 */
	public void checkBlockVar(Integer shopId, Integer blockVarId)
			throws WebBlockException {
		WebBlockVar webBlockVar = webBlockVarDao.findBlockVar(shopId,
				blockVarId);
		if (webBlockVar == null)
			throw new WebBlockException("没有对应的块元素参数");
	}
}
